package com.itlzb.blog.auth.controller;

import com.itlzb.blog.auth.entity.User;
import com.itlzb.blog.auth.service.LoginService;
import com.itlzb.blog.common.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping
public class LoginController {

    @Autowired
    private LoginService loginService;

    @PostMapping("/login")
    public Result login(@RequestBody User user){
        Result result = loginService.login(user);
        return result;
    }

    @PostMapping("/register")
    public Result register(@RequestBody User user){
        Result result = loginService.register(user);
        return result;
    }


}
